﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.Serialization;
using System.Security.Permissions;

using Model.Crafters;
using Model.Raw_Materials;

namespace Model.Items.Weapons.Parts
{
    [Serializable]
    public abstract class Blade : MetalPart
    {
        public Blade() { } //empty ctor for serialization

        protected Blade(SerializationInfo info, StreamingContext context)
            : base(info, context)
        {
            if (info == null)
                throw new System.ArgumentNullException("info");
            
            //swordBlade = info.GetValue("SwordBlade", typeof(SwordBlade)) as SwordBlade;
        }

        public Blade(Crafter crafter, Metal metal, Ornament ornament)
            : base(crafter, metal, ornament)
        {
            BaseName = metal.BaseName;
        }

        public override String Name
        {
            get { return BaseName + " Blade"; }
        }

        public override double MinPrice
        {
            get { return Price = CraftingMetal.Price + CraftingOrnament.Price; }
        }

        public override string ToString()
        {
            return Name + "\n" + base.ToString();
        }

        /*[SecurityPermission(SecurityAction.LinkDemand,
        Flags = SecurityPermissionFlag.SerializationFormatter)]
        public override void GetObjectData(
        SerializationInfo info, StreamingContext context)
        {
            if (info == null)
                throw new System.ArgumentNullException("info");
            base.GetObjectData(info, context);
            
            //info.AddValue("SwordBlade", swordBlade);
        }//*/
    }
}
